/**
 * JAVACC DEMO 1.0
 * @copy right dwusoft company All rights reserved. 
 * @Package com.apache.bid.service.plugins  
 */
package com.apache.bid.service.plugins;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;

import com.apache.api.manager.PluginConnector;
import com.apache.api.vo.ParamsVo;
import com.apache.api.vo.ResultEntity;
import com.apache.bid.entity.BidItemHistory;
import com.apache.cache.util.Validator;
import com.apache.database.db.IDao;
import com.apache.database.model.MethodParam;

/**
 * description:  获取成交结果
 * @author mhguo 创建时间：2016-4-12  
 * 
 */
public class BidItemHistoryListForProIdsPlugin implements PluginConnector {

	private IDao bidItemHistoryDao;
	private Logger logger = Logger.getLogger(BidItemHistoryListForProIdsPlugin.class);

	/**
	 * TODO 简单描述该方法的实现功能（可选）.  
	 * @see com.zbxsoft.api.manager.PluginConnector#execute(com.zbxsoft.api.vo.ParamsVo)  
	 */
	public Object execute(ParamsVo vo) throws Exception {
		ResultEntity result = new ResultEntity();
		try {
			List<String> proIds = (List) vo.getParams("proIds");
			result.setResult("false");
			//单独处理的特殊参数情况[暂无]
			//-------------------
			if (Validator.isEmpty(proIds)) {
				result.setResult("false");
				result.setMessage("查询条件为空!");
				return result;
			}
			MethodParam param = new MethodParam("ByPropertyProIds", "", "", BidItemHistory.class.getName());
			param.setResultCache(false);
			Map map = new HashMap();
			map.put("proIds", proIds);
			param.setParams(map);
			List list = bidItemHistoryDao.select(param);
			logger.info("bidItemHistory表查询的成交结果数：" + list.size());
			result.setEntity(list);
			result.setResult("true");
			result.setMessage("查询完成");
		} catch (Exception e) {
			result.setResult("false");
			logger.error("执行bidItemHistory查询失败 ", e);
			result.setMessage("bidItemHistory查询失败！");
		}
		return result;
	}

	public void setBidItemHistoryDao(IDao bidItemHistoryDao) {
		this.bidItemHistoryDao = bidItemHistoryDao;
	}
}
